import request from "@utils/request";
import Qs from "qs";
import _ from "lodash";

// 登录api
export function loginApi(data) {
  return request({
    url: "mobile/login",
    method: "post",
    data: Qs.stringify(data)
  });
}

// 获取项目列表api
export function listProjects(keyword, page = 0, limit = 14) {
  return request({
    url: "projects",
    method: "get",
    params: _.isEmpty(_.trim(keyword))
      ? { page: page, limit: limit }
      : { keyword: keyword, page: page, limit: limit }
  });
}

// 获取提醒列表api
export function getRemind(id, page = 0, limit = 20) {
  return request({
    url: "remind",
    method: "get",
    params: { id: id, page: page, limit: limit }
  });
}

// 获取项目记录列表api
export function getRecord(id, page = 0, limit = 10) {
  return request({
    url: "record",
    method: "get",
    params: { id: id, page: page, limit: limit }
  });
}

// 获取项目基本信息api
export function getBaseinfo(id) {
  return request({
    url: "baseinfo",
    method: "get",
    params: { id: id }
  });
}
